package com.jucai.pppeiyouclient.adapter;

import android.content.Context;
import android.text.TextUtils;

import com.jucai.pppeiyouclient.R;
import com.jucai.pppeiyouclient.base.CommonRecyclerViewAdapter;
import com.jucai.pppeiyouclient.bean.OrderBean;
import com.jucai.pppeiyouclient.utils.TextCheckUtils;

import java.util.List;

/**
 * Created by Kuky on 2017-04-21.
 */

public class HistoricalOrderAdapter extends CommonRecyclerViewAdapter<OrderBean> {
    public HistoricalOrderAdapter(Context context, List<OrderBean> data) {
        super(context, data);
    }

    @Override
    public void bindHolder(CommonHolder holder, OrderBean orderBean) {
        holder.setImage(R.id.order_user_img, orderBean.getMember_avatar(), 60, 60);
        holder.setText(R.id.order_number, "订单编号：" + orderBean.getTorder_ordersn());

        if(!TextUtils.isEmpty(orderBean.getMember_realname())) {
            holder.setText(R.id.order_user_name, orderBean.getMember_realname());
        }else {
            // String temp = orderBean.getMember_realname();
            //temp = temp.substring(0, 3) + "****" + temp.substring(7, 11);
            holder.setText(R.id.order_user_name, orderBean.getMember_phone());
        }

        holder.setText(R.id.order_start_time, "" + orderBean.getTorder_start_time());
        holder.setText(R.id.order_start_location, "" + orderBean.getTorder_start_point());
        holder.setText(R.id.order_state_str, orderBean.getStatus_str());
        holder.setGone(R.id.order_state);
        holder.setGone(R.id.order_create_time);
        holder.setText(R.id.order_user_info, orderBean.getMember_sexual() + " " + orderBean.getMember_age() + "岁");
        holder.setGone(R.id.order_end);

    }

    @Override
    protected int getItemType(int position) {
        return 0;
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_order_layout;
    }
}
